<?php
    if($accounts->num_rows()>0){
        $account=$accounts->row();
        $date_patern = '%d/%m/%Y';
        $incrit = mdate($date_patern,$account->birthday);
        $gender = '';
        if($account->sex == 'm'){
            $gender = 'Masculin';
        }else{
            $gender = 'Féminin';
        }
    }

    $flag = true;
    //    foreach ($not_friend as $nfr => $value) {
    //        if($value['id']!=$this->session->userdata('doogy_id')){
    //            $flag = false;
    //            echo $value['id'];die;
    //            break;
    //        }
    //    }

    if($not_friend->num_rows()>0){
        $flag = false;
    }
    //1303722176
    $account_id = $this->session->userdata('doogy.id');
    $id = $account->account_id;
?>

<div id="acc_details" style="width: 500px;">
    <div id="title_view_profile" ><span class="noun"><?php echo $account->display_name;?></span>
        <?php if(is_friend($account_id, $account->account_id)):?>
          <?php if($account_id!=$id) {?>
            <span class="title_view_profile_img"><a href="<?php echo site_url('message/send/'.$account->account_id)?>"><img border ="0" title="Envoyer un message" src="<?php echo base_url().'assets/css/'?>images/write_message.png"/></a></span>
                <span class="title_view_profile_right">
            <?php }?>
                <span style="float: right;"><a href="<?php echo site_url('home/compte/'.$account->account_id)?>">Profile</a> | <a href="<?php echo site_url('home/wall_friend/'.$account->account_id)?>">Mur</a> | 
                <?php if($account_id!=$id) {?>
                    <a href="<?php echo site_url('home/galery_friend/'.$account->account_id)?>">Galerie</a>
                <?php } else {?>
                    <a href="<?php echo site_url('image/my_galary/')?>">Galerie</a>
                <?php } ?>
                 </span>    
            <?php endif;?>
        <?php
            $image = './doggy_avatar/images/' . $account->avatar;
            if (file_exists($image) && $account->avatar!=null) {
                $image = base_url() . 'doggy_avatar/images/' . $account->avatar;
            } else {
                $image = root_url('doggy-flirt') . './assets/noimage.gif';
            }
        ?>
    </div>
    <div class="recent_img" align="left">
        <table class="list" width="90%">
            <tr>
                <td width="20%"><img src="<?php echo $image?>" alt="" height="80"/></td>
                <?php
                    if($flag == FALSE){?>
                    <td><a style="padding-left: 10px;" href="<?php echo site_url('friend/send_friend_request/' . $account->account_id); ?>">Ajouter à mes amis</a></td>
                    <?php }?>
            </tr>
            <th colspan="2">Informations généraux</th>
            <tr>
                <td>*Nom d'affichage:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->display_name;?></td>
            </tr>
            <tr>
                <td>*Nom complet:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->fullname;?></td>
            </tr>
            <tr>
                <td>*Couleur:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->color;?></td>
            </tr>
            <tr>
                <td>*Genre:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $gender;?></td>
            </tr>
            <tr>
                <td>*Race:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->race_name;?></td>
            </tr>
            <tr>
                <td>*Région:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->region_name;?></td>
            </tr>
            <tr>
                <td>*Anniversaire:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $incrit;?></td>
            </tr>
            <tr>
                <td>*Adresse:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->address;?></td>
            </tr>
        </table>
        <table class="list" width="90%">
            <th colspan="2">Autres informations</th>
            <tr>
                <td>*Statut:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->mind_status;?></td>
            </tr>
            <tr>
                <td>*Décrivez-vous:</td>
                <td style="color: blue;padding-left: 10px;"><?php echo $account->self_description;?></td>
            </tr>
        </table>


    </div>
</div>
